Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

7311: add GetReceiptsFromPeerTask #7638

Merged
merged 185 commits into from
Oct 30, 2024

Conversation

Matilda-Clerke
Copy link
Contributor

PR description

This PR adds the GetReceiptsFromPeerTask PeerTask for all places the existing related EthTask is used and sets up addition and removal of peers for PeerManager

Matilda-Clerke and others added 30 commits September 17, 2024 13:22
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…e available

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…tantiation

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…en initializing PeerTaskFeatureToggle multiple times

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…peertask-system' into 7311-add-cli-feature-toggle-for-peertask-system
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
* @param syncState the sync state
* @param ethProtocolManager the eth protocol manager
* @param pivotBlockSelector the pivot block selector
* @return the synchronizer
*/
protected DefaultSynchronizer createSynchronizer(
final ProtocolSchedule protocolSchedule,
final Supplier<ProtocolSpec> currentProtocolSpecSupplier,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be needed we can just use the protocol schedule to get a ProtocolSpec

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought so too, but in order to get the ProtocolSpec from a ProtocolSchedule, you need a BlockHeader. The currentProtocolSpecSupplier always grabs the ProtocolSpec for the highest block we have.

Maybe it would make sense for this to be encapsulated in ProtocolSchedule with a getCurrentProtocolSpec method?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it turns out, trying to include this in the ProtocolSchedule ends up with even more code touched, and cyclic dependencies that make it very difficult to achieve

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another way would be just to check that any forks are using POS in the protocol spec, no need to check every block header could do something like what I did the block import to check whether we are on a post merge chain https://github.com/hyperledger/besu/blob/main/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/FastSyncDownloadPipelineFactory.java#L122.

"Unexpectedly got receipts for block header already populated!");
}));
}
// remove all the headers we found receipts for
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The completion logic would be better in GetReceiptsFromPeerTask

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code can only exist in the calling code as it's used to determine if we need to do another GetReceiptsFromPeerTask. When we discussed moving this logic into the GetReceiptsFromPeerTask, we realised that it would result in more confusing, recursive calls to the PeerTaskExecutor.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see how that would make it more complex. This might be the best place to repeat the task for now.

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
… usages

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
… update unit test to test for this functionality

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
* @param syncState the sync state
* @param ethProtocolManager the eth protocol manager
* @param pivotBlockSelector the pivot block selector
* @return the synchronizer
*/
protected DefaultSynchronizer createSynchronizer(
final ProtocolSchedule protocolSchedule,
final Supplier<ProtocolSpec> currentProtocolSpecSupplier,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another way would be just to check that any forks are using POS in the protocol spec, no need to check every block header could do something like what I did the block import to check whether we are on a post merge chain https://github.com/hyperledger/besu/blob/main/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/FastSyncDownloadPipelineFactory.java#L122.

"Unexpectedly got receipts for block header already populated!");
}));
}
// remove all the headers we found receipts for
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see how that would make it more complex. This might be the best place to repeat the task for now.

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…PoS, remove new usages of currentProtocolSpecSupplier

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
@jframe jframe merged commit db29df7 into hyperledger:main Oct 30, 2024
43 checks passed
JanetMo pushed a commit to JanetMo/besu that referenced this pull request Nov 17, 2024
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Marlene Marz <m.marz@kabelmail.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants